<?php if(!defined('WANYA_ROOT')) {exit('error!');}?>
<script language="javascript" type="text/javascript" src="editor/My97DatePicker/WdatePicker.js"></script>
<style type="text/css">
	tr {height: 40px}
</style>
<div class=containertitle><b>优惠卡管理-<?php echo($action=="add"?"添加":"编辑");?></b>
	<?php if(isset($_GET['active_del'])):?><span class="actived">删除用户成功</span><?php endif;?>
	<?php if(isset($_GET['active_show'])):?><span class="actived">编辑用户资料成功</span><?php endif;?>
</div>
<div class=line></div>
	<form action="card.php" name="cardform" id="cardform" method="post" enctype="multipart/form-data">
	<table align="center" >
		<tr>
			<td>
				优惠卡名：　　
			</td>
			<td>
				<input type="text" name="card_name" id="card_name" value="<?php echo($card["card_name"]);?>">
			</td>
			<td colspan="5">

			</td>
		</tr>
		<tr>
			<td>
				有效期限：　　
			</td>
			<td>
				<input class="Wdate" type="text" name="card_deadline" value="<?php echo($card["card_deadline"]);?>" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
			</td>
		</tr>
		<tr>
			<td>
				优惠卡缩略图：　　
			</td>
			<td>
				<input type="file" name="card_cover" id="card_cover" value="<?php echo($card["card_cover"]);?>">（※图片大小 450px*230px）
			</td>
		</tr>
		<?php if($card["card_cover"]){ ?>
		<tr>
			<td>
				 原缩略图：　　
			</td>
			<td>
				<input type="hidden" name="pre_card_cover" value="<?php echo($card["card_cover"]);?>">
				<a href="<?php echo($card["card_cover"]);?>" target="_blank"><?php echo($card["card_cover"]);?></a>
			</td>
		</tr>
		<?php } ?>
		<tr>
			<td valign="top">
				说　　明：　　
			</td>
			<td>
				<textarea rows="5" cols="40" name="card_comment"><?php echo($card["card_comment"]);?></textarea>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<input type="button" name="cancel" value="取消" onclick="formCancel()" class="button">	　　　
				<input type="button" name="confirm" value="确认" onclick="formCheck()" class="button">　　
			</td>
		</tr>
	</table>
		<input type="hidden" name="ID" value="<?php echo($card["ID"]);?>">
		<input type="hidden" name="action" id="action" value="<?php echo($action);?>">
		<input type="hidden" name="mode" value="commit">　
	</form>
<script type="text/javascript">

	function formCheck()
	{
		if($("#action").val()=="add")
		{
			if($("#card_name").val()=="")
			{
				alert("请输入优惠卡名称！");
				return;
			}
		}


		$("#cardform").submit();
	}
	function formCancel()
	{
		window.location.href="card.php";
	}
</script>